<html>
<head><meta charset="utf-8"><title>inverse of liberate_late_bound_regions · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html">inverse of liberate_late_bound_regions</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="240874780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/240874780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#240874780">(May 31 2021 at 22:01)</a>:</h4>
<p>is there an inverse to <code>liberate_late_bound_regions</code>? Would that make any sense?</p>



<a name="240875342"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/240875342" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#240875342">(May 31 2021 at 22:10)</a>:</h4>
<p>given the opaque <code>impl Future</code> that is returned from an HRTB closure, I want to see if I can "un-liberate" the free regions that the <code>impl Future</code> contains, to re-bind them back under the binder that they were originally bound under, before we created the librated signature to pass to <code>check_fn</code> when checking the closure</p>



<a name="241068837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241068837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241068837">(Jun 01 2021 at 20:12)</a>:</h4>
<p><span class="user-mention" data-user-id="125273">@mikeyhew</span> that sounds kind of suspicious</p>



<a name="241068849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241068849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241068849">(Jun 01 2021 at 20:12)</a>:</h4>
<p>can you say a bit more about the scenario you are in?</p>



<a name="241069131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241069131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241069131">(Jun 01 2021 at 20:14)</a>:</h4>
<p>basically, I've been trying to see if I could make this possible:</p>



<a name="241069347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241069347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241069347">(Jun 01 2021 at 20:16)</a>:</h4>
<div class="codehilite"><pre><span></span><code>fn bar&lt;F&gt;(_: F)
where
    F: for&lt;&#39;a&gt; FnOnce&lt;(&amp;&#39;a i32,)&gt;,
    for&lt;&#39;a&gt; &lt;F as FnOnce&lt;(&amp;&#39;a i32,)&gt;&gt;::Output: Future&lt;Output = String&gt;,
{}

fn baz() {
    bar(|x| async move {
        x.to_string()
    });
}
</code></pre></div>



<a name="241069551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241069551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241069551">(Jun 01 2021 at 20:18)</a>:</h4>
<p>right now the sig that gets inferred for the closure that I passed to <code>bar</code> doesn't have any bound lifetimes</p>



<a name="241070365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241070365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241070365">(Jun 01 2021 at 20:25)</a>:</h4>
<p>because <code>deduce_expectations_from_obligations</code> doesn't return an expected signature, because it only looks for an <code>&lt;F as FnOnce&gt;::Output</code> projection predicate, which <code>bar</code> doesn't have</p>



<a name="241070626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241070626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241070626">(Jun 01 2021 at 20:27)</a>:</h4>
<p>I see</p>



<a name="241070627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241070627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241070627">(Jun 01 2021 at 20:27)</a>:</h4>
<p>I was trying to make it infer an HRTB closure in the case where there is a <code>for&lt;'a&gt; F: FnOnce&lt;(&amp;'a i32)&gt;</code> trait predicate without a projection predicate. I can get it to infer a signature of <code>for&lt;'a&gt; fn(&amp;'a i32) -&gt; _</code>, where <code>_</code> is some type variable, but that type variable is the same no matter the value of <code>'a</code></p>



<a name="241070752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241070752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241070752">(Jun 01 2021 at 20:28)</a>:</h4>
<p>I see</p>



<a name="241070763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241070763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241070763">(Jun 01 2021 at 20:28)</a>:</h4>
<p>so you wanted to generalize the return type</p>



<a name="241070789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241070789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241070789">(Jun 01 2021 at 20:28)</a>:</h4>
<p>did you have any ideas about how this could be implemented? I didn't really ask around first, I kind of just jumped into the compiler code to take a look</p>



<a name="241070826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241070826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241070826">(Jun 01 2021 at 20:28)</a>:</h4>
<blockquote>
<p>so you wanted to generalize the return type</p>
</blockquote>
<p>yes</p>



<a name="241071127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241071127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241071127">(Jun 01 2021 at 20:31)</a>:</h4>
<p>well, so, it happens that <span class="user-mention" data-user-id="232957">@Jack Huey</span> added a similar operation</p>



<a name="241071164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241071164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241071164">(Jun 01 2021 at 20:31)</a>:</h4>
<p>indeed, we were discussing how to handle it <em>properly</em></p>



<a name="241071181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241071181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241071181">(Jun 01 2021 at 20:31)</a>:</h4>
<p>this might be a use case where that'd be useful</p>



<a name="241071252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241071252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241071252">(Jun 01 2021 at 20:32)</a>:</h4>
<p>this is part of the work to normalize under binders</p>



<a name="241071440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241071440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241071440">(Jun 01 2021 at 20:33)</a>:</h4>
<p>actually, I'm basing this off of his binder refactor PR: <a href="https://github.com/rust-lang/rust/pull/85499">https://github.com/rust-lang/rust/pull/85499</a></p>



<a name="241071687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241071687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241071687">(Jun 01 2021 at 20:35)</a>:</h4>
<p>yeah so that code does a similar map</p>



<a name="241071791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241071791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241071791">(Jun 01 2021 at 20:36)</a>:</h4>
<p>but I don't know the entire context of that PR, I just used it because I was getting an error about <code>F as FnOnce&lt;(&amp;'a i32)&gt;::Output</code> not implementing <code>Future</code> which went away when I based off of his PR</p>



<a name="241072140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241072140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241072140">(Jun 01 2021 at 20:39)</a>:</h4>
<p>I'll take a closer look at that PR and see if I can understand what it does</p>



<a name="241072237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241072237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241072237">(Jun 01 2021 at 20:40)</a>:</h4>
<p>there's a step that he never implemented</p>



<a name="241072250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241072250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241072250">(Jun 01 2021 at 20:40)</a>:</h4>
<p>but basically if you look at the <code>fold_binder</code> method</p>



<a name="241072271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241072271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241072271">(Jun 01 2021 at 20:40)</a>:</h4>
<p>you'll see it uses a folder to go back from placeholders to bound things</p>



<a name="241072289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241072289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241072289">(Jun 01 2021 at 20:40)</a>:</h4>
<p>in the PR?</p>



<a name="241072292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241072292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241072292">(Jun 01 2021 at 20:40)</a>:</h4>
<p>the step that was never implemented is to manage cases where the inference has not completed by the time that operation must be performed</p>



<a name="241072294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241072294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241072294">(Jun 01 2021 at 20:40)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125273">mikeyhew</span> <a href="#narrow/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions/near/241072289">said</a>:</p>
<blockquote>
<p>in the PR?</p>
</blockquote>
<p>yes</p>



<a name="241072316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241072316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241072316">(Jun 01 2021 at 20:40)</a>:</h4>
<p>partly that's because I owe him a test case where this matters :)</p>



<a name="241072504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241072504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241072504">(Jun 01 2021 at 20:42)</a>:</h4>
<p>I think I found it, is it this comment? <a href="https://github.com/rust-lang/rust/pull/85499/files#r635713696">https://github.com/rust-lang/rust/pull/85499/files#r635713696</a></p>



<a name="241072584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241072584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241072584">(Jun 01 2021 at 20:43)</a>:</h4>
<blockquote>
<p>I never implemented the "normalize to an inference variable then quantify the bound vars over the placeholders when the type is fully known" scheme, but seems like it's not needed?</p>
</blockquote>



<a name="241072752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241072752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241072752">(Jun 01 2021 at 20:44)</a>:</h4>
<p>sounds right</p>



<a name="241072902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241072902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241072902">(Jun 01 2021 at 20:45)</a>:</h4>
<p>that sounds like what I think I want. A way to create an inference variable for the <code>&lt;F as FnOnce&lt;(&amp;'a i32)&gt;&gt;::Output</code> type, and create a bound function signature with that inference variable as the return type</p>



<a name="241073042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241073042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241073042">(Jun 01 2021 at 20:46)</a>:</h4>
<p>and then when it resolves, all of the <code>'a</code> regions in the resolved type need to be bound in the bound sig</p>



<a name="241073463"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241073463" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241073463">(Jun 01 2021 at 20:49)</a>:</h4>
<p>how would you implement that?</p>



<a name="241073622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241073622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241073622">(Jun 01 2021 at 20:50)</a>:</h4>
<p>you would basically add a new kind of predicate</p>



<a name="241073635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241073635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241073635">(Jun 01 2021 at 20:50)</a>:</h4>
<p><code>Generalize(?A -&gt; ?B)</code></p>



<a name="241073644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241073644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241073644">(Jun 01 2021 at 20:50)</a>:</h4>
<p>it probably needs to take a list of placeholders or something</p>



<a name="241073684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241073684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241073684">(Jun 01 2021 at 20:50)</a>:</h4>
<p>it would refuse to make progress until <code>?A</code> is "sufficiently well known"</p>



<a name="241073705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241073705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241073705">(Jun 01 2021 at 20:51)</a>:</h4>
<p>and/or maybe convert itself into new <code>Generalize</code> predicates if it can make progress on some parts but not others</p>



<a name="241073778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241073778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241073778">(Jun 01 2021 at 20:51)</a>:</h4>
<p>interesting...</p>



<a name="241073918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241073918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241073918">(Jun 01 2021 at 20:52)</a>:</h4>
<p>what would be an example of <code>?A</code> and <code>?B</code>?</p>



<a name="241074047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241074047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241074047">(Jun 01 2021 at 20:53)</a>:</h4>
<p>also would this just be in chalk, or the old trait solver as well?</p>



<a name="241074189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241074189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241074189">(Jun 01 2021 at 20:54)</a>:</h4>
<p>did you guys talk about this strategy in here before? It would be interesting to read the discussion</p>



<a name="241074560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241074560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241074560">(Jun 01 2021 at 20:57)</a>:</h4>
<p>I'm talking specifically about the old trait solver</p>



<a name="241074587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241074587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241074587">(Jun 01 2021 at 20:57)</a>:</h4>
<p>this isn't needed in chalk because we just never do this normalization under binders operation</p>



<a name="241074599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241074599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241074599">(Jun 01 2021 at 20:58)</a>:</h4>
<p>we only go "downards"</p>



<a name="241074635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241074635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241074635">(Jun 01 2021 at 20:58)</a>:</h4>
<p>this is enabled by lazy norm</p>



<a name="241074653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241074653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241074653">(Jun 01 2021 at 20:58)</a>:</h4>
<p>ah ok</p>



<a name="241074660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241074660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241074660">(Jun 01 2021 at 20:58)</a>:</h4>
<p>we would need it, though, to do generaliation of closure signatures</p>



<a name="241074677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241074677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241074677">(Jun 01 2021 at 20:58)</a>:</h4>
<p>which is something I've thought about before</p>



<a name="241074709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241074709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241074709">(Jun 01 2021 at 20:58)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125273">mikeyhew</span> <a href="#narrow/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions/near/241074189">said</a>:</p>
<blockquote>
<p>did you guys talk about this strategy in here before? It would be interesting to read the discussion</p>
</blockquote>
<p>we did .. I think in <a class="stream-topic" data-stream-id="144729" href="/#narrow/stream/144729-wg-traits/topic/GAT.20Bugs.20.2376826.2C.20.2376407">#wg-traits &gt; GAT Bugs #76826, #76407</a></p>



<a name="241076608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241076608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241076608">(Jun 01 2021 at 21:14)</a>:</h4>
<p>thanks, I read through it, couldn't follow everything but maybe will later when I know more</p>



<a name="241076616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241076616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241076616">(Jun 01 2021 at 21:14)</a>:</h4>
<p>what does a <code>Generalize(?A -&gt; ?B)</code> predicate mean? Is it saying that <code>?A</code> has to generalize to <code>?B</code>? And would <code>?B</code> have a binder around it?</p>



<a name="241078290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241078290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241078290">(Jun 01 2021 at 21:28)</a>:</h4>
<p>probably the proper form is <code>Generalize(?A -&gt; for&lt;'a, ..., 'z&gt; ?B)</code></p>



<a name="241078333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/inverse%20of%20liberate_late_bound_regions/near/241078333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/inverse.20of.20liberate_late_bound_regions.html#241078333">(Jun 01 2021 at 21:28)</a>:</h4>
<p>that is, you take a type <code>?A</code> with placeholders and you generalize it into bound form where those placeholders become <code>'a...'z</code></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>